<template>
	<van-field
		:class="{
			[slotClass ? slotClass : '']: true,
			'app-control-form__item': true,
			[`app-control-form__item--${labelPos.toLowerCase()}`]: true,
			[`app-control-form__item__${name}`]: true,
			[`anchor__${name}`]: enableAnchor,
		}"
		:colon="false"
		:style="slotStyle"
		:name="name"
		v-model="curValue"
		:rules="rules"
		:required="required"
		:error-message="error"
		:label="label"
		:label-width="labelWidth"
	>
		<template #input>
			<slot></slot>
		</template>
	</van-field>
</template>
<script setup lang="ts">
import { formItemProps } from '../form';
const props = defineProps(formItemProps);
const curValue = ref('');

watch(
	() => props.value,
	(newVal: any, oldVal: any) => {
		curValue.value = newVal;
	},
	{
		immediate: true,
	}
);

</script>
